/*0GI1xcoeligdpMeXoHBphggJgy1ecejSkxa04FXn/MW9FwzMYLMeZK3mD3mLyGPh*/
import { ajax, toast ,promptBox} from 'nc-lightapp-front';
import { billType, tableId } from '../constants';
import { innerButton } from '../../../../public/components/pubUtils/buttonName.js';
import madeBill from '../../../../public/components/madeBill.js';
export default function (that,props, key, text, record, index) {
    switch (key) {
        case innerButton.Edit_inner:
            ajax({
                url: '/nccloud/arap/arappub/edit.do',
                data: {
                    pk_bill: record.pk_paybill.value,
                    billType: billType
                },
                success: (res) => {
                    if (res.success) {
                        let src ='';
                        if(res.data&&res.data.isFrom36S3){
                            src ='36S3';
                        }
                        if (props.getUrlParam("scene") == 'linksce' || props.getUrlParam("scene") == 'fip') {
                            props.pushTo('/card', {
                                status: 'edit',
                                id: record.pk_paybill.value,
                                pagecode:'20080EBM_CARD_LINK',
                                scene:'linksce',
                                srcFrom36S3:src
                            })
                        }else{
                            props.pushTo('/card', {
                                status: 'edit',
                                id: record.pk_paybill.value,
                                pagecode:record.pk_tradetype.value,
                                srcFrom36S3:src
                            })
                        }
                    }
                }
            });
            break;
        case innerButton.Delete_Inner:
            that.Info.pk_bill = record.pk_paybill.value
            that.Info.ts = record.ts.value
            that.Info.index = index;
            that.delConfirm();           
            break;
        case innerButton.Copy_inner:
            if (props.getUrlParam("scene") == 'linksce' ||props.getUrlParam("scene") == 'fip') {
                props.pushTo('/card', {
                    status: 'add',
                    id: record.pk_paybill.value,
                    type: 'copy',
                    pagecode:'20080EBM_CARD_LINK',
                    scene:'linksce'
                })
            }else{
                if(record.objtype.value == '0'&&record.isrefund&&record.isrefund.value ){
                    toast({ color: 'danger', content: that.state.json['paybill-000056'] }); /* 国际化处理：退款付款单不能执行该操作！*/
                    return true;
                }
                props.pushTo('/card', {
                    status: 'add',
                    id: record.pk_paybill.value,
                    type: 'copy',
                    pagecode:record.pk_tradetype.value,
                })
            }
            break;
        case innerButton.Commit_inner:
            that.Info.tipUrl = '/nccloud/arap/arappub/commit.do';
            that.Info.record = record;
            that.commitAndUncommit();
            break;
        case innerButton.Uncommit_inner:
            that.Info.tipUrl = '/nccloud/arap/arappub/uncommit.do';
            that.Info.record = record;
            that.commitAndUncommit();
            break;
        case innerButton.MadeBill_inner://制单
            let madeData = [{
                pk_bill: record.pk_paybill.value,
                billType: billType,
                tradeType: record.pk_tradetype.value,
            }]
            madeBill(that,props,madeData,'',props.getSearchParam('c'));
            break;
        default:
            break;
    }
};

/*0GI1xcoeligdpMeXoHBphggJgy1ecejSkxa04FXn/MW9FwzMYLMeZK3mD3mLyGPh*/